<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>index,need yingyong01&kuan=800&gao=600</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            overflow: hidden;
            font-family: Arial, sans-serif;
            background-color: transparent; /* Light gray background */
        }
        /* 禁止所有子元素移动 */
        /*.container_zs{*/
        /*overflow: hidden;*/
        /*position: static !important;*/
        /*user-select: none; *//**//* 防止文本被选中 */
        /*}*/
        draggable-component {
            display: block;
            position: absolute;
            width: auto;
            height: auto;
            /*background-color: lightblue;*/
            /*border: 2px solid black;*/
            top: 50px;
            left: 50px;
        }
    </style>
    <script>
        function isEmptyObject(obj) {
            return Object.keys(obj).length === 0 && obj.constructor === Object;
        }
        function loadStylesheet(filename) {
            const link = document.createElement('link');
            link.rel = 'stylesheet';
            link.type = 'text/css';
            link.href = filename;
            document.getElementsByTagName('head')[0].appendChild(link);
        }
        function getQueryParams() {
            const queryParams = {};
            const queryString = window.location.search.substring(1);
            const paramsArray = queryString.split('&');

            paramsArray.forEach(param => {
                if (param) {
                    const [key, value] = param.split('=');
                    queryParams[key] = decodeURIComponent(value || '');
                }
            });

            return queryParams;
        }

        // 示例用法
        const params = getQueryParams();
        console.log(params); // 输出: { key1: 'value1', key2: 'value2' }
        if (isEmptyObject(params)){
            alert("需要输入参数！")
        }
        var v_yingyongname=params['yingyong'];
        var v_kuan=params['kuan'];
        var v_gao=params['gao'];

        console.log(v_yingyongname);
        const stylesheetName = './'+v_yingyongname+'.css'; // 这里可以使用任何变量或逻辑来决定文件名
        loadStylesheet(stylesheetName);
    </script>
    <script src="../components/bigbang.js" type="module"></script>
    <script src="../nodraggable-component.js"></script>
</head>
<body>
<div id="container_zs" style="position: relative;overflow: hidden;">
    <script>

        async function loadContent(url) {
            try {
                const response = await fetch(url);
                if (!response.ok) {
                    throw new Error('网络响应失败');
                }
                const text = await response.text();
                console.log(text);
                var dydiv = document.getElementById('container_zs');
                dydiv.style.width = v_kuan+'px';
                dydiv.style.height = v_gao+'px';
                dydiv.innerHTML = text;

            } catch (error) {
                console.error('无法加载内容:', error);
            }
        }

        // 加载 subpage.html 的内容
        const contentName = './'+v_yingyongname+'.html';
        loadContent(contentName);

    </script>
</div>


<script src="./jquery-3.6.0.min.js"></script>
<script>
    function loadScript(filename) {
        const script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = filename;
        script.async = true; // 设置为异步加载

        // 可选：添加事件监听器以检测脚本何时加载完成
        script.onload = function() {
            console.log('Script loaded and executed:', filename);
        };

        script.onerror = function() {
            console.error('Failed to load script:', filename);
        };

        document.head.appendChild(script); // 将脚本添加到 head 或 body 中
    }
    const scriptName = './'+v_yingyongname+'.js'; // 这里可以使用任何变量或逻辑来决定文件名
    loadScript(scriptName);

</script>

</body>
</html>


